package com.szrt.java.day20161228.demo01;



/**
 *     选择排序
 *     9 8 7 6 5 
 *     0 1 2 3 4
 *     1轮    01 02 03 04
 *     2论    12 13 14
 *     3轮    23 24 
 *     4轮    34
 *     
 * 
 * 
 * 
 * @author zsrt
 *
 */
public class SelectSort02 {
	public static void main(String[] args) {
		
		int[] arrays = {9,8,7,6,5,4};
		
		//5
		int len = arrays.length;
		
		for(int outer=0;outer<=len-2;outer++){
			
			//int innerLength= arrays.length-1;

			for(int inner=1+outer;inner<=len-1;inner++){
				System.out.println(outer+ ":"+inner);
				if(arrays[outer] > arrays[inner]){
					int temp;
					temp= arrays[outer];
					arrays[outer]=arrays[inner];
					arrays[inner]=temp;
				}
			}
		}

		for(int v : arrays ){
			System.out.print(v +" ");
		}
		
		
		
		
	}

}
